<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

	<title>DAMN Unit tests</title>

  <script src="http://code.jquery.com/jquery-latest.js"></script>
  <link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css" type="text/css" media="screen" />
  
  <script type="text/javascript" src="http://code.jquery.com/qunit/qunit-git.js"></script>

 
  
  <script>
    $(document).ready(function(){
     {% for service in services %} 
          module("{{ service.section }} url: {{ service.url }}");
          asyncTest("Testing {{ service.url }}", function() {
            $.ajax({
              url: '{% url 'assets.tests.test' %}?url={{ service.url }}',
              success: function(data, textStatus, jqXHR){
                equal(jqXHR.status, 200, jqXHR.responseText);
                start();
              },
              error: function(jqXHR, textStatus, errorThrown){
                ok(false, errorThrown);
                if (jqXHR.status != 500){
                  try {
                  var data = JSON.parse(jqXHR.responseText);
                  for (d in data){
                    ok(false, data[d]);
                  }
                  } catch(e) {
                    ok(false, jqXHR.responseText);
                  }
                }
                else
                  $('#log').html(jqXHR.responseText);
                start();
              }
            });
          });
      {% endfor %}

    });
  </script>

</head>
<body>
 <ol id="qunit-tests"></ol>
 <div id="qunit-fixture">test markup, will be hidden</div>
 <div id="log"></div>
</body>
</html>
</html>
